<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .none{
      display: none;
    }
  </style>
</head>

<body>
  <div>1 <button>阿牛</button></div>
  <div>2 <button>阿牛</button></div>
  <div>3 <button>阿牛</button></div>
  <script>
    class Todo {
      constructor() {
        this.items = document.querySelectorAll('div')
        this.lists = new WeakSet()
        this.items.forEach(element => {
          this.lists.add(element)
        });
      }

      run() {
        this.addEvent()
      }

      addEvent() {
        this.items.forEach((item) => {
          let button = item.querySelector('button')
          let that = this;
          button.addEventListener('click', function (e) {
            let parentElement = e.target.parentElement;
            setInterval(() => {
              if (that.lists.has(parentElement)) {
                parentElement.classList.add('none')
                that.lists.delete(parentElement)
              }
            }, 200);
          })
        })
      }
    }

    new Todo().run()
  </script>
</body>

</html>